package com.example.objects;

public class ContactObject {
	public String firstName;
	public String lastName;
	public String address;
	public String phoneHome;
	public String phoneMobile;
	public String phoneWork;
	public String emailPrimary;
	public String emailSecondary;
	public String bdayDay;
	public String bdayMonth;
	public String bdayYear;
	public String groupByValue;
	public int groupByIndex;
	public String addressSecondary;
	public String phoneSecondary;
	public String id;
	
	public ContactObject(){
	}
	
	public ContactObject(ContactObject oldContact){
		this.firstName = oldContact.firstName;
		this.lastName = oldContact.lastName;
		this.address = oldContact.address;
		this.phoneHome = oldContact.phoneHome;
		this.phoneMobile = oldContact.phoneMobile;
		this.phoneWork = oldContact.phoneWork;
		this.emailPrimary = oldContact.emailPrimary;
		this.emailSecondary = oldContact.emailSecondary;
		this.bdayDay = oldContact.bdayDay;
		this.bdayMonth = oldContact.bdayMonth;
		this.bdayYear = oldContact.bdayYear;
		this.groupByValue = oldContact.groupByValue;
		this.groupByIndex = oldContact.groupByIndex;
		this.addressSecondary = oldContact.addressSecondary;
		this.phoneSecondary = oldContact.phoneSecondary;
		this.id = oldContact.id;	
	}

	public ContactObject setFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}

	public ContactObject setLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}

	public String setFullName(String title) {
		String fullName = setFirstName(firstName) + " " + setLastName(lastName);
		return fullName;
	}

	public ContactObject setAddress(String address) {
		this.address = address;
		return this;
	}

	public ContactObject setPhoneHome(String phoneHome) {
		this.phoneHome = phoneHome;
		return this;
	}

	public ContactObject setPhoneMobile(String phoneMobile) {
		this.phoneMobile = phoneMobile;
		return this;
	}

	public ContactObject setPhoneWork(String phoneWork) {
		this.phoneWork = phoneWork;
		return this;
	}

	public ContactObject setEmailPrimary(String emailPrimary) {
		this.emailPrimary = emailPrimary;
		return this;
	}

	public ContactObject setEmailSecondary(String emailSecondary) {
		this.emailSecondary = emailSecondary;
		return this;
	}

	public ContactObject setBdayDay(String bdayDay) {
		this.bdayDay = bdayDay;
		return this;
	}

	public ContactObject setBdayMonth(String bdayMonth) {
		this.bdayMonth = bdayMonth;
		return this;
	}

	public ContactObject setBdayYear(String bdayYear) {
		this.bdayYear = bdayYear;
		return this;
	}

	public ContactObject setGroupByValue(String groupByValue) {
		this.groupByValue = groupByValue;
		return this;
	}

	public ContactObject setGroupByIndex(int groupByIndex) {
		this.groupByIndex = groupByIndex;
		return this;
	}

	public ContactObject setAddressSecondary(String addressSecondary) {
		this.addressSecondary = addressSecondary;
		return this;
	}

	public ContactObject setPhoneSecondary(String phoneSecondary) {
		this.phoneSecondary = phoneSecondary;
		return this;
	}

	public ContactObject setId(String id) {
		this.id = id;
		return this;
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getAddress() {
		return address;
	}

	public String getPhoneHome() {
		return phoneHome;
	}

	public String getPhoneMobile() {
		return phoneMobile;
	}

	public String getPhoneWork() {
		return phoneWork;
	}

	public String getEmailPrimary() {
		return emailPrimary;
	}

	public String getEmailSecondary() {
		return emailSecondary;
	}

	public String getBdayDay() {
		return bdayDay;
	}

	public String getBdayMonth() {
		return bdayMonth;
	}

	public String getBdayYear() {
		return bdayYear;
	}

	public String getGroupByValue() {
		return groupByValue;
	}

	public int getGroupByIndex() {
		return groupByIndex;
	}

	public String getAddressSecondary() {
		return addressSecondary;
	}

	public String getPhoneSecondary() {
		return phoneSecondary;
	}

	public String getId() {
		return id;
	}

	@Override
	public String toString() {
		return "Contact [" + id + " " + firstName + " " + lastName + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((firstName == null) ? 0 : firstName.hashCode());
		result = prime * result
				+ ((lastName == null) ? 0 : lastName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactObject other = (ContactObject) obj;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		if (id != null && other.id != null) {
			return id.equals(other.id);
		}
		return true;
	}

}
